package com.xxgc.eow.service.impl;

import com.xxgc.eow.entity.Secondaycomment;
import com.xxgc.eow.mapper.SecondaycommentMapper;
import com.xxgc.eow.service.ISecondaycommentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 二级评论（评论下面的评论） 服务实现类
 * </p>
 *
 * @author Mr.Abel
 * @since 2023-05-22
 */
@Service
public class SecondaycommentServiceImpl extends ServiceImpl<SecondaycommentMapper, Secondaycomment> implements ISecondaycommentService {

    @Resource
    private SecondaycommentMapper secondaycommentMapper;

    @Override
    public Secondaycomment selectCommentId(int commentId) {
        return secondaycommentMapper.selectByCommentId(commentId);
    }

    @Override
    public int delSecondayComment(int secondayCommentId) {
        Date date = new Date();
        LocalDateTime ldt = LocalDateTime.ofInstant(date.toInstant(), ZoneOffset.UTC);
        LocalDateTime ldt1 = LocalDateTime.ofInstant(date.toInstant(),ZoneOffset.ofHours(5));
        return secondaycommentMapper.delSecondayComment(secondayCommentId,ldt);

    }

    @Override
    public List<Secondaycomment> selectAll() {
        return secondaycommentMapper.selectAll();
    }
}
